{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Linear Regression From Scratch.\n",
    "\n",
    "    Divyanshu Vyas | dvyas13ad@gmail.com\n",
    "    \n",
    "    This Notebook will help us understand how we can perform Linear Regresssion with Just basic Python Knowledge."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x132e55a5e50>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deXhU9d3+8fdnsoeQhIQAIQQCJOw7YRNQEVDqitQFtYpWobXu2lp99NH6tLa2dnGrWlxRUXBBcaEu4Aayhn0JkEASkhCSQCBkIet8f3/M0F+KCSSZzJzJzOd1XVwzc+ZM5s4JuXPmLN8jxhiUUkr5FpvVAZRSSrU9LXellPJBWu5KKeWDtNyVUsoHabkrpZQPCrQ6AEDnzp1NUlKS1TGUUqpd2bhx42FjTFxjz3lFuSclJZGWlmZ1DKWUaldEJKep53SzjFJK+SAtd6WU8kFa7kop5YO03JVSygdpuSullA86Y7mLyKsiUiQiOxpMixGRr0Qkw3nbqcFzD4pIpojsEZEL3BXcZQsXQlIS2GyO24ULrU6klFJtpjlr7q8DM06Z9gCwwhiTAqxwPkZEBgGzgcHO1zwvIgFtlratLFwI8+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RPzeGJ5Ned7/xi4wXkEyHig9OTHa3dy7r95BUg3xvy9iXm6OedDRMbi+L0+4uZczfm5WLLMnJr89GzF8mqgOV3UNr+L7t5j3Bb/cBRSHlANFAJfNHjuIRx7lvcAP2kw/WWcR9YAscAKIMN5G+PGrK8DvzxlWndgmfN+Hxx7v7cCO3FsnnD38nsT2A5sc/4niT81l/PxhTiOxtjnoVyZOLYtbnH+e9Gq5dXY9w788uTPEsdH5X86n99Og6O23LyMJuH4SL6twXK68JRstzuXzVYcO6bP8kCuRn8uXrLMwnGUdVSDaR5fXjj+uBQAtc7+urmpLnLH76IOP6CUUj6ovW+WUUop1Qgtd6WU8kFa7kop5YO03JVSygdpuSullA/ScldKKR+k5a6UUj7o/wF8ZaKasG3ekAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.linspace(-10,10,100)\n",
    "\n",
    "y = x**2\n",
    "\n",
    "plt.plot(x,y)\n",
    "plt.scatter(-9,100 , color='red')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "x1 = np.random.random(10000) #distance mall\n",
    "x2 = np.random.random(10000) #size\n",
    "x3 = np.random.random(10000) #age"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = x1 +5*x2 - 10*x3 + 20\n",
    "\n",
    "w_actual = [1 , 5, -10]\n",
    "b_actual = 20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>x1</th>\n",
       "      <th>x2</th>\n",
       "      <th>x3</th>\n",
       "      <th>y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.508908</td>\n",
       "      <td>0.835660</td>\n",
       "      <td>0.553935</td>\n",
       "      <td>19.147864</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.726204</td>\n",
       "      <td>0.392882</td>\n",
       "      <td>0.343057</td>\n",
       "      <td>19.260043</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.505177</td>\n",
       "      <td>0.973191</td>\n",
       "      <td>0.697124</td>\n",
       "      <td>18.399889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.333480</td>\n",
       "      <td>0.989429</td>\n",
       "      <td>0.809244</td>\n",
       "      <td>17.188183</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.782781</td>\n",
       "      <td>0.238237</td>\n",
       "      <td>0.360815</td>\n",
       "      <td>18.365819</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         x1        x2        x3          y\n",
       "0  0.508908  0.835660  0.553935  19.147864\n",
       "1  0.726204  0.392882  0.343057  19.260043\n",
       "2  0.505177  0.973191  0.697124  18.399889\n",
       "3  0.333480  0.989429  0.809244  17.188183\n",
       "4  0.782781  0.238237  0.360815  18.365819"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame({'x1':x1 , 'x2':x2 , 'x3' :x3 , 'y':y})\n",
    "\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(10000, 1)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X = np.array(df[['x1' , 'x2' , 'x3']])\n",
    "\n",
    "y = np.array(df['y']).reshape(10000,1)\n",
    "\n",
    "#(10000,1)\n",
    "\n",
    "\n",
    "#X --> (10000 , 3)\n",
    "#y --> (10000 , 1)\n",
    "#W ---> (3,1)\n",
    "#b --> (1,1) or scalar\n",
    "# Z--> (10000 , 1)\n",
    "\n",
    "#Y(P) = Z = W.X + b    # np.dot(X,W)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "def cost(w,b,X,y):\n",
    "    \n",
    "    #X - 10000x3\n",
    "    #y - 10000x1\n",
    "    #w - 3x1\n",
    "    #b = 1x1\n",
    "    \n",
    "    Z = np.dot(X , w) + b\n",
    "    \n",
    "    L = (y - Z)**2\n",
    "    \n",
    "    m = len(y)\n",
    "    \n",
    "    J = np.sqrt((1/m)*np.sum(L))\n",
    "    \n",
    "    return J\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Some Formulas\n",
    "\n",
    "## 1. $ J(w,b) = \\frac {1}{m} \\sum [y - (W.X + b)]^2 $\n",
    "\n",
    "## 2. $ \\frac {\\partial J}{\\partial W} = \\frac {-2}{m} (X^T . [y - (W.X + b)]) $\n",
    "\n",
    "## 3. $ \\frac {\\partial J} {\\partial b} = \\frac {-2}{m} \\sum [ y - (W.X + b) ] $"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "def gradient(w,b,X,y):\n",
    "    \n",
    "    #dw = dJ/dw = 3x1\n",
    "    #db = dJ/db = 1x1\n",
    "    \n",
    "        \n",
    "    #X - 10000x3\n",
    "    #y - 10000x1\n",
    "    #w - 3x1\n",
    "    #b = 1x1\n",
    "    \n",
    "    Z = np.dot(X , w) + b\n",
    "    \n",
    "    J = cost(w,b,X,y)\n",
    "    \n",
    "    m = X.shape[0]\n",
    "    \n",
    "    dw = (-2/m)*np.dot(X.T , (y - Z))\n",
    "    \n",
    "    db = (-2/m)*np.sum(y - Z)\n",
    "    \n",
    "    return dw , db\n",
    "    \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "# X.shape\n",
    "\n",
    "# y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "17.504301537642572"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Just a check on how terrible our initial guess is performing.\n",
    "w = np.random.random((3,1))\n",
    "b = 0\n",
    "\n",
    "cost(w,b,X,y)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Now Let's Make it Learn!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "def learning(w,b,X,y,epoch):\n",
    "    \n",
    "    #dw = dJ/dw = 3x1\n",
    "    #db = dJ/db = 1x1\n",
    "    \n",
    "    #X - 10000x3\n",
    "    #y - 10000x1\n",
    "    #w - 3x1\n",
    "    #b = 1x1\n",
    "    \n",
    "    Z = np.dot(X , w) + b\n",
    "    \n",
    "    costs = []\n",
    "    \n",
    "    costs.append(cost(w,b,X,y))\n",
    "    \n",
    "    for e in range(epoch):\n",
    "        \n",
    "        dw , db = gradient(w,b,X,y)\n",
    "        \n",
    "        w = w - 0.005*dw\n",
    "        \n",
    "        b = b - 0.005*db\n",
    "        \n",
    "        if e%100 == 0:\n",
    "            costs.append(cost(w,b,X,y))\n",
    "        \n",
    "    \n",
    "    wf = w\n",
    "    bf = b\n",
    "    \n",
    "    return wf , bf , costs\n",
    "    \n",
    "    \n",
    "    \n",
    "        \n",
    "        \n",
    "    \n",
    "    \n",
    "    \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "wf , bf , costs = learning(w,b,X,y,100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([[ 40.3625116 ,  37.93906267,  35.56507188,  33.24053923,\n",
       "          30.96546473,  28.73984836,  26.56369014,  24.43699006,\n",
       "          22.35974812,  20.33196432,  18.35363866,  16.42477115,\n",
       "          14.54536177,  12.71541054,  10.93491745,   9.2038825 ,\n",
       "           7.52230569,   5.89018702,   4.3075265 ,   2.77432412,\n",
       "           1.29057987,  -0.14370623,  -1.52853419,  -2.86390401,\n",
       "          -4.14981568,  -5.38626922,  -6.57326461,  -7.71080187,\n",
       "          -8.79888098,  -9.83750195, -10.82666478, -11.76636946,\n",
       "         -12.65661601, -13.49740441, -14.28873468, -15.0306068 ,\n",
       "         -15.72302078, -16.36597662, -16.95947431, -17.50351387,\n",
       "         -17.99809528, -18.44321856, -18.83888369, -19.18509068,\n",
       "         -19.48183953, -19.72913023, -19.9269628 , -20.07533722,\n",
       "         -20.1742535 , -20.22371165, -20.22371165, -20.1742535 ,\n",
       "         -20.07533722, -19.9269628 , -19.72913023, -19.48183953,\n",
       "         -19.18509068, -18.83888369, -18.44321856, -17.99809528,\n",
       "         -17.50351387, -16.95947431, -16.36597662, -15.72302078,\n",
       "         -15.0306068 , -14.28873468, -13.49740441, -12.65661601,\n",
       "         -11.76636946, -10.82666478,  -9.83750195,  -8.79888098,\n",
       "          -7.71080187,  -6.57326461,  -5.38626922,  -4.14981568,\n",
       "          -2.86390401,  -1.52853419,  -0.14370623,   1.29057987,\n",
       "           2.77432412,   4.3075265 ,   5.89018702,   7.52230569,\n",
       "           9.2038825 ,  10.93491745,  12.71541054,  14.54536177,\n",
       "          16.42477115,  18.35363866,  20.33196432,  22.35974812,\n",
       "          24.43699006,  26.56369014,  28.73984836,  30.96546473,\n",
       "          33.24053923,  35.56507188,  37.93906267,  40.3625116 ],\n",
       "        [ 39.53480455,  37.16334874,  34.84028999,  32.5656283 ,\n",
       "          30.33936366,  28.16149609,  26.03202556,  23.9509521 ,\n",
       "          21.9182757 ,  19.93399635,  17.99811406,  16.11062882,\n",
       "          14.27154064,  12.48084953,  10.73855546,   9.04465846,\n",
       "           7.39915851,   5.80205562,   4.25334979,   2.75304101,\n",
       "           1.30112929,  -0.10238537,  -1.45750297,  -2.76422352,\n",
       "          -4.02254701,  -5.23247344,  -6.39400282,  -7.50713513,\n",
       "          -8.57187039,  -9.5882086 , -10.55614974, -11.47569383,\n",
       "         -12.34684086, -13.16959084, -13.94394375, -14.66989961,\n",
       "         -15.34745841, -15.97662016, -16.55738485, -17.08975248,\n",
       "         -17.57372305, -18.00929656, -18.39647302, -18.73525242,\n",
       "         -19.02563477, -19.26762005, -19.46120828, -19.60639945,\n",
       "         -19.70319357, -19.75159063, -19.75159063, -19.70319357,\n",
       "         -19.60639945, -19.46120828, -19.26762005, -19.02563477,\n",
       "         -18.73525242, -18.39647302, -18.00929656, -17.57372305,\n",
       "         -17.08975248, -16.55738485, -15.97662016, -15.34745841,\n",
       "         -14.66989961, -13.94394375, -13.16959084, -12.34684086,\n",
       "         -11.47569383, -10.55614974,  -9.5882086 ,  -8.57187039,\n",
       "          -7.50713513,  -6.39400282,  -5.23247344,  -4.02254701,\n",
       "          -2.76422352,  -1.45750297,  -0.10238537,   1.30112929,\n",
       "           2.75304101,   4.25334979,   5.80205562,   7.39915851,\n",
       "           9.04465846,  10.73855546,  12.48084953,  14.27154064,\n",
       "          16.11062882,  17.99811406,  19.93399635,  21.9182757 ,\n",
       "          23.9509521 ,  26.03202556,  28.16149609,  30.33936366,\n",
       "          32.5656283 ,  34.84028999,  37.16334874,  39.53480455],\n",
       "        [ 40.098925  ,  37.67513566,  35.30081141,  32.97595226,\n",
       "          30.70055819,  28.4746292 ,  26.29816531,  24.17116651,\n",
       "          22.09363279,  20.06556416,  18.08696063,  16.15782218,\n",
       "          14.27814881,  12.44794054,  10.66719736,   8.93591926,\n",
       "           7.25410625,   5.62175833,   4.0388755 ,   2.50545776,\n",
       "           1.0215051 ,  -0.41298246,  -1.79800494,  -3.13356233,\n",
       "          -4.41965463,  -5.65628184,  -6.84344396,  -7.981141  ,\n",
       "          -9.06937294, -10.1081398 , -11.09744157, -12.03727825,\n",
       "         -12.92764985, -13.76855635, -14.55999776, -15.30197409,\n",
       "         -15.99448533, -16.63753148, -17.23111254, -17.77522852,\n",
       "         -18.2698794 , -18.7150652 , -19.1107859 , -19.45704152,\n",
       "         -19.75383205, -20.0011575 , -20.19901785, -20.34741312,\n",
       "         -20.44634329, -20.49580838, -20.49580838, -20.44634329,\n",
       "         -20.34741312, -20.19901785, -20.0011575 , -19.75383205,\n",
       "         -19.45704152, -19.1107859 , -18.7150652 , -18.2698794 ,\n",
       "         -17.77522852, -17.23111254, -16.63753148, -15.99448533,\n",
       "         -15.30197409, -14.55999776, -13.76855635, -12.92764985,\n",
       "         -12.03727825, -11.09744157, -10.1081398 ,  -9.06937294,\n",
       "          -7.981141  ,  -6.84344396,  -5.65628184,  -4.41965463,\n",
       "          -3.13356233,  -1.79800494,  -0.41298246,   1.0215051 ,\n",
       "           2.50545776,   4.0388755 ,   5.62175833,   7.25410625,\n",
       "           8.93591926,  10.66719736,  12.44794054,  14.27814881,\n",
       "          16.15782218,  18.08696063,  20.06556416,  22.09363279,\n",
       "          24.17116651,  26.29816531,  28.4746292 ,  30.70055819,\n",
       "          32.97595226,  35.30081141,  37.67513566,  40.098925  ]]),\n",
       " 33.56405075248543)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wf , bf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEU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LpSbJGwgGp7DjgBkknA/9g5V3kxgHXpLt5LSdL/IsaOGZH4FZJ6wECLo2I94v2iszMffZm1rTUZz80It7OOxYzW3M+jW9mZtbGuWVvZmbWxrllb2Zm1sY52ZuZmbVxTvZmZmZtnJO9mZlZG+dkb2Zm1sb9f37RySu/gGT7AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 576x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize = (8,4))\n",
    "plt.style.use('default')\n",
    "plt.plot(costs ,c='red' , marker='x')\n",
    "plt.xlabel('Epochs')\n",
    "plt.ylabel('Error')\n",
    "plt.title('Optimization Progress : Linear Regression!')\n",
    "\n",
    "plt.grid()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "metadata": {},
   "outputs": [],
   "source": [
    "Actual = ['w1 = 1' , 'w2 =5' , 'w3 = -10', 'b = 20']\n",
    "\n",
    "ModelResults = [f'w1 = {wf[0][0]}' ,f'w2 = {wf[1][0]}',f'w3 = {wf[2][0]}', f'b = {bf}' ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "metadata": {},
   "outputs": [],
   "source": [
    "results = pd.DataFrame({'Actual Parameters':Actual , 'Model-Parameters':ModelResults})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Actual Parameters</th>\n",
       "      <th>Model-Parameters</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>w1 = 1</td>\n",
       "      <td>w1 = 1.0657494018932743</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>w2 =5</td>\n",
       "      <td>w2 = 5.063592418656829</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>w3 = -10</td>\n",
       "      <td>w3 = -9.92998037745159</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>b = 20</td>\n",
       "      <td>b = 19.895068110806836</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Actual Parameters         Model-Parameters\n",
       "0            w1 = 1  w1 = 1.0657494018932743\n",
       "1             w2 =5   w2 = 5.063592418656829\n",
       "2          w3 = -10   w3 = -9.92998037745159\n",
       "3            b = 20   b = 19.895068110806836"
      ]
     },
     "execution_count": 129,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
